<?php 
$PWD_SALT="some-salt+in*the&origianl#password";

$URL_MY_PAGE='http://www.jztzp.com/account/my.php';
$URL_LOGIN_PAGE='http://www.jztzp.com/account/login.php';
$URL_LOGOUT_PAGE='http://www.jztzp.com/account/logout.php';
$URL_REGISTER_PAGE='http://www.jztzp.com/account/register.php';

function GetLoginId($ticket) {
  return apc_fetch('user_ticket_' . $ticket);
}

function GetAccountInfo($id) {
  $apc_key = 'user_account_' . $id;
  $account = apc_fetch($apc_key);
  if (!$account) {
    $sql = sprintf("SELECT email, nick, password FROM password WHERE id=%d", $id); 
    mysql_select_db("user_account");
    $result = mysql_query($sql);
    if ($result) {
      $account = mysql_fetch_array($result);
      apc_add($apc_key, $account, 60 * 60);
    }
  }

  return $account;
}

function SetLoginId($id, $ticket) {
  return apc_add('user_ticket_' . $ticket, $id, 60 * 60);
}

function GetPasswordHash($pwd) {
  return md5($PWD_SALT . $pwd);
}

function GetFavoriteKey($user_id) {
  return "user:favorites:" . $user_id;
}
?>
